package TestInterDemo;
//测试匿内部类
public class TestAnonymousInnerclass {
    public void test(A a){
        a.run();
    }

    public static void main(String[] args) {
        TestAnonymousInnerclass tai = new TestAnonymousInnerclass();
//        tai.test(new AA());
        tai.test(new A() {
            @Override
            public void run() {
                System.out.println("TestAnonymousInnerclass.run11");
            }
        });
        tai.test(new A() {
            @Override
            public void run() {
                System.out.println("TestAnonymousInnerclass.run22");

            }
        });
    }

}
//有名字的类，可以反复使用
class AA implements A{

    @Override
    public void run() {
        System.out.println("AA.run");
    }
}

interface A{
    void run();

}